// 订单列表
// 用户列表

    <!-- 项目管理 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">订单列表</p>
    <!-- sonRouter="yybureauFormationBJ" 为跳转新的页面编辑 -->
    <dxtable
      :dataJson="dataJson"
      :portUrl="portUrl"
      :qx="qx"
      :headBtn="headBtnw"
      :isshowXz="false"
      ref="databale"
    ></dxtable>
  </div>
</template>
<script lang='ts' setup>
import dxtable from "../../components/util/dxtable.vue";
import sort from "../../components/util/sort.vue";
import { dxget, dxpost } from "../../util/index";
import { NButton, NImage, NTag } from "naive-ui";
import { h, ref, reactive } from "vue";
const databale = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
const kmxcfrt = ["周期订单", "团购订单", "买单订单"];
const headBtnw = ref([
  {
    name: "导出",
    jy: true,
    loading: false,
    clickFun: async () => {
      headBtnw.value[0].loading = true;
      const kxcxdfe = [];
      const { data }: any = await dxget(
        "meirong/dingdan/dingdan?page=1&pageSize=9999"
      );
      data.data.map((a) => {
        const cfdsfa = kmxcfrt[a.ddlx - 1];
        kxcxdfe.push({
          订单编号: a.ddbianhao,
          标题: a.title,
          订单类型: cfdsfa,
          价格: a.jiage,
          店铺名称: a.dpname,
          客户昵称: a.nickname,
          客户电话: a.phone,
          订单使用状态: "未使用",
          购买时间: a.addTime,
          核销时间: "",
        });
      });
      const dfdsfrew = await dxpost("public/jsonToexcel", {
        jsonData: JSON.stringify(kxcxdfe),
        columnWidths:
          "[{ wch: 26 },{ wch: 34 },{ wch: 10 },{ wch: 6},{ wch: 20 },{ wch: 20 },{ wch: 20 },{ wch: 20 },{ wch: 20 },{ wch: 20 }]",
      });
      open(dfdsfrew.data);
      headBtnw.value[0].loading = false;
    },
  },
]);
let dataJson = [
  {
    title: "订单编号",
    key: "ddbianhao",
    width: 190,
  },
  {
    title: "封面",
    type: "img",
    width: 100,
    key: "cover",
  },
  {
    title: "标题",
    key: "title",
    search: true,
  },
  {
    title: "价格",
    key: "jiage",
    search: false,
    width: 80,
  },
  {
    title: "店铺名称",
    key: "dpname",
    search: false,
  },
  {
    title: "客户昵称",
    key: "nickname",
    search: false,
  },
  {
    title: "客户电话",
    key: "openid",
    search: true,
    type: "select",
    options: [],
    width: 120,
    render(h) {
      return h.phone;
    },
  },
  {
    title: "订单使用状态",
    key: "",
    search: false,
    width: 120,
    render(h) {
      return "未使用";
    },
  },

  {
    title: "购买时间",
    key: "addTime",
    width: 150,
  },
  {
    title: "核销时间",
    key: "",
    width: 150,
  },
];

const qx = {
  DeletePermissionID: "zfbUserdel", //删除
  EditPermissionIdentifier: "23456", // 编辑
  NewPermissionIdentifier: "", // 新建
  ViewPermissionID: "zfbUserck", // 查看
};
const portUrl = "meirong/dingdan/dingdan?ddlx=2&zzhn="+localStorage.Userid;

let formJson = reactive([]);
const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {},
        },
        "复制代码"
      ),
    ];
  },
};
const jkmcxzff = async () => {
  const { data }: any = await dxget("meirong/api/jxzcxsdff");
  console.log(data);
  dataJson[7].options = [
    {
      label: "全部",
      value: "",
    },
    ...data,
  ];
};
jkmcxzff();
// 获取字典内容
// const xtgxxmfl = async () => {
//   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'xtgxxmfl' })
//   dataJson[2].options = [
//     {
//       label: "全部",
//       value: ""
//     },
//     ...data
//   ]
//   formJson[2].options = data
//   xmlxSelect.value = data
//   console.log(data);
// }
// xtgxxmfl()
</script>
<style scoped></style>
    